<template>
  <div id="windowTopSearch">
    <div class="search-box">
      <el-form
        ref="searchForm"
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
        @submit.native.prevent
      >
        <el-form-item label="商品名称：" prop="searchVal">
          <el-input
            size="small"
            v-model="formInline.searchVal"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item class="s-btn">
          <el-button type="success" icon="el-icon-search" @click="toSearch">
            查询
          </el-button>
          <el-button type="success" plain @click="reset">
            重置
          </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formInline: {
        searchVal: undefined
      }
    }
  },
  methods: {
    // 搜索
    toSearch() {
      this.$emit('toSearch', this.formInline)
    },
    // 重置
    reset() {
      this.$refs['searchForm'].resetFields()
    }
  }
}
</script>
<style lang="less"></style>
